package com.gitee.controller;

import com.gitee.pojo.User;
import com.gitee.sdk.UserSDK;
import com.gitee.service.IUserService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/client")
public class ClientController {

    @Autowired
    private IUserService userService;

    @GetMapping("/user")
    public UserSDK getUserSDK(Integer userId) {
        User user = userService.getById(userId);
        UserSDK userSDK = new UserSDK();
        BeanUtils.copyProperties(user, userSDK);
        return userSDK;
    }

}
